// pages/mingxi/mingxi.js
var app =getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //内容
    wendaArr: [

    ],
    list:[],
    page:0,
    pagesize:10,
    zid:"",
    did:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var did = options.did;
    var zid = options.zid;
    if(did != '' && did != 'undefined' && did != undefined)
    {
      that.setData({
        did:did
      })
      
    }
    if(zid != '' && zid != 'undefined' && zid != undefined)
    {
      that.setData({
        zid:zid
      })
      
    }
    that.getList();
  },
  getList:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/green.tixian_list",
      data:{
        did:that.data.did,
        zid:that.data.zid,
        page:that.data.page,
        pagesize:that.data.pagesize
      },
      success:function(res){
        if(res.data.length >= 10)
        {
          var page = that.data.page + 1;
        }else{
          var page = that.data.page
        };
        that.setData({
          page:page,
          list:that.data.list.concat(res.data),
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.getList();
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})